#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 10;

int rk[N],sa[N],ork[N << 1],px[N],cnt[N],n,m,id[N];
char s[N];

void getSA() {
    m = 300; for(int i = 1;i <= m;i++) cnt[i] = 0; 
    for(int i = 1;i <= n;i++) ++cnt[rk[i] = s[i]];
    for(int i = 1;i <= m;i++) cnt[i] += cnt[i - 1];
    for(int i = n;i >= 1;i--) sa[cnt[rk[i]]--] = i;
    for(int h = 1,p;h <= n;h <<= 1,m = p) {
	p = 0; for(int i = n;i > n - h;i--) id[++p] = i;
	for(int i = 1;i <= n;i++) if(sa[i] > h) id[++p] = sa[i] - h;
	for(int i = 1;i <= m;i++) cnt[i] = 0;
	for(int i = 1;i <= n;i++) ++cnt[px[i] = rk[id[i]]];
	for(int i = 1;i <= m;i++) cnt[i] += cnt[i - 1];
	for(int i = n;i >= 1;i--) sa[cnt[px[i]]--] = id[i];
	for(int i = 1;i <= n;i++) ork[i] = rk[i];
	auto cmp = [&] (int x,int y) { return ork[x] == ork[y] && ork[x + h] == ork[y + h]; };
	p = 0; for(int i = 1;i <= n;i++) rk[sa[i]] = cmp(sa[i - 1],sa[i]) ? p : ++p;
    }
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
    scanf("%s",s + 1); n = strlen(s + 1); getSA();
    for(int i = 1;i <= n;i++) printf("%d%c",sa[i]," \n"[i == n]);
    return 0;
}
